CREATE TABLE [dbo].[test_isnull_table](
       [id] [bigint] IDENTITY(1,1) NOT NULL,
       [my_varchar_data] [varchar](20) NULL,
       [my_computed_column] AS isnull([my_varchar_data],[id])) 
GO

INSERT INTO [dbo].[test_isnull_table]([my_varchar_data])VALUES ('1')
INSERT INTO [dbo].[test_isnull_table]([my_varchar_data])VALUES (NULL)
GO

create view [dbo].[test_isnull_view] as select isnull([my_varchar_data],[id]) from [dbo].[test_isnull_table];
GO

create view [dbo].[test_isnull_view1] as select * from [dbo].[test_isnull_table] where isnull([my_varchar_data],[id]) = 1;
GO

create view [dbo].[test_isnull_view2] as select * from [dbo].[test_isnull_table] where isnull(NULL,[id]) = 1;
GO

create view [dbo].[test_isnull_view3] as
select ISNULL(NULL, NULL);
GO

create view [dbo].[test_isnull_view4] as
select ISNULL(NULL, 'Unassigned');
GO

create view [dbo].[test_isnull_view5] as
select
  ISNULL([my_varchar_data], 'Unassigned')
from [dbo].[test_isnull_table];
GO

create view [dbo].[test_isnull_view6] as
select ISNULL('Unassigned', 1);
GO

create view [dbo].[test_isnull_view7] as
select ISNULL ('', 5);
GO

CREATE FUNCTION [dbo].[test_isnull_func1]()
RETURNS BIGINT AS
BEGIN
    DECLARE @ans BIGINT
    SELECT @ans= isnull([my_varchar_data],[id]) from [dbo].[test_isnull_table] where isnull([my_varchar_data],[id]) = 1
    RETURN @ans
END
GO

CREATE FUNCTION [dbo].[test_isnull_func2](@in1 varchar(20), @in2 bigint)
RETURNS BIGINT AS
BEGIN
    DECLARE @ans BIGINT = isnull(@in1, @in2) 
	RETURN @ans
END
GO

CREATE PROCEDURE [dbo].[test_isnull_proc1]
AS
select
  ISNULL(NULL, NULL),
  ISNULL(NULL, 'Unassigned'),
  ISNULL([my_varchar_data], 'Unassigned'),
  ISNULL('Unassigned', 1),
  ISNULL ('', 5)
from [dbo].[test_isnull_table] where isnull([my_varchar_data],[id]) = 1;
GO